/**
 * @created  April 19, 2007
 * @author adelaye
 *
 * This class is a format used by IHM to communicate informations
 * about a Sensor to the SensorSimulator
 */
package kernel;

import java.util.*;
import objects.Station;
import comRadiusController.*;

public class DataSensor extends DataMobileStation{

    public static final double MEAS_RAD_MIN = 1;
    public static final double MEAS_RAD_DEF = 10;
    public static final double MEAS_RAD_MAX = 1000;
    public double _measRadius;

    /**
     * Default constructor
     */
    public DataSensor(){
	super();
	setMeasurementRadius(MEAS_RAD_DEF);
    }
    
	
    /**
     * Constructor
     */
    public DataSensor (
		      String name,
		      double x,
		      double y,
		      double maxReachRadius,
		      double carrierRate,
		      double batteryLevel,
		      double[] consumption,
		      ComRadiusController controller,
		      Vector probes,
		      float fmin,
		      float fmax,
		      int nbfreq,
		      double measRadius) {
	super();
	setName(name);
	setCoordX(x);
	setCoordY(y);
	setMaxReachRadius(maxReachRadius);
	setCarrierRate(carrierRate);
	setConsumption(consumption);
	setBatteryLevel(batteryLevel);
	setController(controller);
	setProbes(probes);
	setFmin(fmin);
	setFmax(fmax);
	setNbFreq(nbfreq);
	setMeasurementRadius(measRadius);
    }

    public boolean setMeasurementRadius(double m){
	boolean done = false;
	if(checkBounds(MEAS_RAD_MIN,MEAS_RAD_MAX,m)){
	    _measRadius = m;
	    done = true;	    
	}else{
	    _measRadius = MEAS_RAD_DEF;
	    done = false;
	}
	return done;
    }

    public double getMeasurementRadius(){
	return _measRadius;
    }

    public String toString()
    {
	return super.toString() + "\n" + "measurementRadius = " + _measRadius;
    }
}